home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc / Developer Documentation / International / TSMTE Support < prev   
Encoding:
Text File  |  1995-11-08  |  3.8 KB  |  100 lines  |  [TEXT/ttxt]

  1. TSMTE Support
  2. by The OpenDoc™ Design Team
  3. November 7, 1995
  4.  
  5.  
  6. © 1993-1995  Apple Computer, Inc. All Rights Reserved.
  7. Apple, the Apple logo, and Macintosh are registered trademarks of Apple Computer, Inc.
  8. Mac and OpenDoc are trademarks of Apple Computer, Inc.
  9.  
  10.  
  11. Introduction
  12.  
  13. OpenDoc supports the Text Services Manager (TSM), and, in particular inline text input.  OpenDoc does nothing special to support the TSMTE extension.  So you have to do some additional work as for a current QuickDraw application which is using TextEdit with the TSMTE extension.  The extension is named "Inline Support" in the English system with the Japanese Language Kit or  "ÉCÉìÉâÉCÉìí«â¡ã@î\" in the Japanese system.  It provides you the inline input in TextEdit easily.
  14.  
  15.  
  16. What's TSMTE?
  17.  
  18. TSMTE is an extension to the Text Services Manager that does the second part of the work for you if you use TextEdit.  It provides Apple event handlers that handle all interactions between an input method and TextEdit.  The handlers are kept in the system heap, so they are shared between all applications.  TSMTE can reduce the effort needed to implement inline input to a day or two.   (See Technical Notes TE27 for the details)
  19.  
  20.  
  21. General support
  22.  
  23. OpenDoc calls InitTSMAwareApp, CloseTSMAwareApp, TSMEvent, TSMMenuSelect, and SetTSMCursor at the appropriate times. Parts do not need to call any of these.
  24.  
  25.  
  26. Inline input support
  27.  
  28. First,  you need to specify the definition to include the TSMTE header file in your source code as follows.  The header file is contained in the Developer CD.
  29.  
  30.     #ifdef __TSMTE__   
  31.     #include "TSMTE.h"
  32.     #endif
  33.  
  34. Parts wishing to use the TSMTE extension must check for its existence themselves.
  35.  
  36.     long           result;
  37.     
  38.     if (Gestalt(kTSMTESignature, &result) == noErr    &&
  39.         (result & (1 << gestaltTSMTE)) != 0)
  40.             // You can use TSMTE. Set the TSMTE available flag to kODTrue.
  41.     else
  42.             // You cannot use TSMTE. Set the TSMTE available flag to kODFalse.
  43.  
  44. After creating a text edit record by calling TENew or TEStyleNew, the part has to create a TSM document and enable the inline input by calling UseInputWindow API.
  45.  
  46.     OSErr          err;
  47.     OSType         interfaceTypes[]= {kTSMTEInterfaceType};
  48.     TSMDocumentID  tsmDocID;
  49.     TSMTERecHandle tsmteH;
  50.  
  51.     if (the TSMTE available flag is kODTrue)
  52.     {
  53.         err = NewTSMDocument(1, interfaceTypes, &tsmDocID, (long)&tsmteH);
  54.         if (err == noErr)
  55.         {
  56.             (*tsmteH)->textH          = theTE; // A handle to the TERec to be inline input.
  57.             (*tsmteH)->preUpdateProc  = kODNULL;
  58.             (*tsmteH)->postUpdateProc = kODNULL;
  59.             (*tsmteH)->updateFlag     = kTSMTEAutoScroll;
  60.             (*tsmteH)->refCon         = kODNULL;
  61.  
  62.             UseInputWindow(kODNULL, kODFalse);
  63.         }
  64.     }
  65.  
  66. When you activate or deactivate the text edit record, you have to call the API for activating/deactivating the TSM document at the same time.
  67.  
  68.     // Activate the specified text edit record
  69.     if (the TSMTE available flag is kODTrue)
  70.     {
  71.         ActivateTSMDocument(tsmDocID);
  72.     }
  73.     TEActivate(theTE);
  74.  
  75.     // Deactivate the specified text edit record
  76.     if (the TSMTE available flag is kODTrue)
  77.     {
  78.         DeactivateTSMDocument(tsmDocID);
  79.     }
  80.     TEDeactivate(theTE);
  81.  
  82. Finally,  when the text edit record is removed and released by calling TEDispose, you have to call the API for TSM at the same time.
  83.  
  84.     // Dispose the specified text edit record
  85.     if (the TSMTE available flag is kODTrue)
  86.     {
  87.         DeleteTSMDocument(tsmDocID);
  88.     }
  89.     TEDispose(theTE);
  90.  
  91.  
  92. TSM document Share
  93.  
  94. To be added in DR4.
  95.  
  96.  
  97. Additional Info
  98.  
  99. See also TSM support recipe in the folder Documentation:Recipes.
  100. Regarding information on TSMTE, you can find technical notes, the TSMTE extension, header files, and sample code is available on the Developer CD.  The latest information is on the May 95 CD.